﻿//---------------------------------------------------------------------------------
// Copyright 2011 Microsoft Corporation
// Licensed under the Microsoft Public License (MS-PL) (the "License"); 
// You may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.opensource.org/licenses/ms-pl.html
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR 
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
// INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
// MERCHANTABLITY OR NON-INFRINGEMENT. 
// See the Microsoft Public License (MS-PL) for the specific language governing 
// permissions and limitations under the License.
//---------------------------------------------------------------------------------

using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Metadata;

[assembly: ProvideMetadata(typeof(Microsoft.Telco.Controls.Design.MetadataRegistration))]

namespace Microsoft.Telco.Controls.Design
{
    /// <summary>
    /// MetadataRegistration class.
    /// </summary>
    public partial class MetadataRegistration : MetadataRegistrationBase, IProvideAttributeTable
    {
        /// <summary>
        /// Design time metadata registration class.
        /// </summary>
        public MetadataRegistration()
            : base()
        {
            // The default constructor sets value of AssemblyFullName and 
            // XmlResourceName used by MetadataRegistrationBase.AddDescriptions().
            //Type t = typeof(PhoneNumberControl);
            //AssemblyName an = t.Assembly.GetName();
            //AssemblyFullName = ", " + an.FullName;
            //XmlResourceName = t.Namespace + ".Design." + an.Name + ".XML";
        }

        /// <summary>
        /// Gets the AttributeTable for design time metadata.
        /// </summary>
        public AttributeTable AttributeTable
        {
            get
            {
                return BuildAttributeTable();
            }
        }

        /// <summary>
        /// Provide a place to add custom attributes without creating a AttributeTableBuilder subclass.
        /// </summary>
        /// <param name="builder">The assembly attribute table builder.</param>
        protected override void AddAttributes(AttributeTableBuilder builder)
        {
            // Note: everything added here must be duplicated in VisualStudio.Design as well!
            builder.AddCallback(typeof(TelcoControlBase), b =>
                    b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                            typeof(TelcoButton),
                            b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(CountryPicker),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(PhoneNumberControl),
                   b =>
                   {
                       b.AddCustomAttributes(new ToolboxBrowsableAttribute(false),
                           new ToolboxCategoryAttribute(ToolboxCategoryPaths.Controls));
                   });
            builder.AddCallback(
                typeof(SMSControl),
                 b =>
                 {
                     b.AddCustomAttributes(new ToolboxBrowsableAttribute(true),
                         new ToolboxCategoryAttribute(ToolboxCategoryPaths.Controls));
                 });
            builder.AddCallback(
                typeof(AdvertisingControl),
                b =>
                {
                    b.AddCustomAttributes(new ToolboxBrowsableAttribute(true),
                        new ToolboxCategoryAttribute(ToolboxCategoryPaths.Controls));
                });
            builder.AddCallback(typeof(AttachedFilesList),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(typeof(ReceivedMessagesList),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(typeof(TranscribeMediaControl),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(true), new ToolboxCategoryAttribute(ToolboxCategoryPaths.Controls)));
        }
    }
}
